<%
    if @contact.is_spanish? then  str_and = "y" else str_and = "and" end
    countries = ""
    first = true
    @news_letter.countries.each_index { |i|
      if first
        countries = "#{@news_letter.countries[i].name}"
        first = false
      else
        if i == @news_letter.countries.size-1
          countries += " #{str_and} #{@news_letter.countries[i].name}"
        else
          countries += ", #{@news_letter.countries[i].name}"
        end
      end
    }
%>

<%= "#{@contact.regard.description} #{@contact.treatment.description}" %> :<br/>
<% if @contact.is_spanish? %>
  Disponemos para la venta una selección de <%= @materials.size %> libros de <%= countries %>. <%=@news_letter.optional_text_spanish%><br/>
  Aceptamos pedidos y reservas por e-mail.<br/>
  Saludos cordiales,<br/>
  <br/>
  RettaLibros<br/>
  En libros de <%= countries %>, los mejores precios y el mejor servicio.<br/>
<% else %>
  We have for sale a selection of <%=@materials.size%> books of <%= countries %>. <%=@news_letter.optional_text_english%><br/>
  We accept orders and reservations via e-mail.<br/>
  Best regards,<br/>
  <br/>
  RettaLibros<br/>
  In books of <%= countries %>, the best prices and best service.<br/>
<% end %>

<p>
  <% if @contact.is_spanish? %>
    Lista: <%= "#{@news_letter.created_at.day}#{@news_letter.created_at.month}#{@news_letter.created_at.year}" %> | Titulo: <%= @news_letter.subject_mail_spanish %> | Paises : <%= countries %> | Cantidad de materiales: <%= @materials.size %>
  <% else %>
    List: <%= "#{@news_letter.created_at.day}#{@news_letter.created_at.month}#{@news_letter.created_at.year}" %> | Title: <%= @news_letter.subject_mail_english %> | Countries : <%= countries %> | Materials count: <%= @materials.size %>
  <% end %>
</p>

<% index = 0 %>
<% @materials.each do |material| %>    
    <% index += 1 %>
    <p>
      <%=render :partial=>'materials/material_info_for_news_mail_text', :locals => {:index => index, :material => material} %>
    </p>
<% end %>
